package com.Arsanesia.TempleRush.Controllers.Listeners;

import com.Arsanesia.TempleRush.TempleRush;
import com.Arsanesia.TempleRush.Models.Profile;
import com.Arsanesia.TempleRush.Views.Screens.AbstractScreen;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.InputEvent;

public class HighScoreListener extends ChangeScreenOnClickListener{
	private final float BOTTOM_MARGIN = 10;
	private final float SIDE_MARGIN = 30;
	private final float BUTTON_WIDTH = 131;
	private final float BUTTON_HEIGHT = 85;
	
	private Rectangle backbound, resetbound;
	private Profile profile;
	public HighScoreListener(TempleRush game) {
		super(game);
		backbound = new Rectangle(SIDE_MARGIN, BOTTOM_MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT);
		resetbound = new Rectangle(AbstractScreen.VIEWPORT_DEFAULTWIDTH - SIDE_MARGIN - BUTTON_WIDTH,
									BOTTOM_MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT);
		profile = game.getProfileManager().retrieveProfile();
	}
	public void clicked(InputEvent event, float x, float y){
		super.clicked(event, x, y);
		if(backbound.contains(x,y)){
			game.setScreen(game.getMenuScreen());
		}else if(resetbound.contains(x,y)){
			profile.resetProfile();
			game.getProfileManager().persist();
		}
		
	}

}
